<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div
      @contextmenu.stop="emit('onContextMenuChild', $event, index)"
      v-for="(item, index) in props.info.showpieceList"
      :key="index"
      class="item-parent"
    >
      <div class="exhibits-item">
        <div class="cover-box" @click="viewImg(item.moduleId, item.id)">
          <div class="cover-title">
            <p>{{ item.name }}</p>
          </div>
          <img class="cover" :src="getLinkUrl(item.coverUrl,'?imageView2/3/w/600/format/webp')" alt="" />
          <img v-if="route.meta.loopType" class="flower-btn" :src="publicUrls + 'free/style2/flower.webp'" />
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free13Style6',
});
</script>

<script setup lang="ts">
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick, defineComponent } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';
import { useRoute } from 'vue-router';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const route = useRoute();
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: end;
  z-index: 999;
  padding: 0 !important;
}

.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}
.item-parent {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 300px;
  margin: 10px 4px;
  flex-shrink: 0;
  position: relative;
  &:nth-child(5n + 1) {
    height: 572px;
    background: url('https://static.jiyi.show/free/style13/exhibitionStandStyle6Bg.webp') no-repeat center/100% 100%;
  }
  &:nth-child(5n + 2) {
    height: 654px;
    background: url('https://static.jiyi.show/free/style13/exhibitionStandStyle6Bg1.webp') no-repeat center/100% 100%;
  }
  &:nth-child(5n + 3) {
    height: 522px;
    background: url('https://static.jiyi.show/free/style13/exhibitionStandStyle6Bg2.webp') no-repeat center/100% 100%;
  }
  &:nth-child(5n + 4) {
    height: 592px;
    background: url('https://static.jiyi.show/free/style13/exhibitionStandStyle6Bg3.webp') no-repeat center/100% 100%;
  }
  &:nth-child(5n) {
    height: 692px;
    background: url('https://static.jiyi.show/free/style13/exhibitionStandStyle6Bg4.webp') no-repeat center/100% 100%;
  }
  .exhibits-item {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 30px;
    padding-top: 55px;
    padding-bottom: 67px;

    .cover-box {
      width: 240px;
      height: 100%;
      position: relative;
      overflow: hidden;
      &:hover .cover {
        transform: scale(1.5);
      }
      &:hover .cover-title {
        opacity: 1;
      }
      .cover {
        width: 100%;
        height: 100%;
        object-fit: contain;
        transition: all 0.3s ease;
      }
      .flower-btn {
        width: 50px;
        height: 50px;
        object-fit: cover;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        animation: flower 2s linear infinite;
        @keyframes flower {
          0% {
            opacity: 0;
          }
          40% {
            opacity: 100%;
          }
          60% {
            opacity: 100%;
          }
          100% {
            opacity: 0;
          }
        }
      }
      .cover-title {
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        position: absolute;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1;
        opacity: 0;
        transition: all 0.3s ease;
        ::v-deep p {
          max-height: 220px;
          font-family: SourceHanSerifCN-Bold;
          font-size: 18px;
          color: #fff;
          line-height: 210px;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          writing-mode: vertical-rl;
          text-orientation: upright;
          letter-spacing: 4px;
        }
      }
    }
  }
}
</style>
